package com.easy.common.enumbean;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum UserStatus {
    //'正常', '禁用'
    NORMAL("正常"),DISABLE("禁用");
    @EnumValue
    private String value;
    private UserStatus(String value) {
        this.value = value;
    }
    @JsonValue
    public String getValue() {
        return this.value;
    }

    @JsonCreator
    public static  UserStatus convert(String val){
        switch (val){
            case "正常":
                return NORMAL;
            case "禁用":
                return DISABLE;
            default:
                throw new RuntimeException("没有对应的枚举类型");
        }
    }

    public String valueOf(){
        return this.value;
    }
    public String toString() {
        return this.value;
    }
}
